package com.scalar.chiptrack.finance.openpo.actioncommands;

import com.scalar.chiptrack.commons.Constants;
import com.scalar.chiptrack.ChipTrackExtendedAction;

/**
 * Created by IntelliJ IDEA.
 * User: Phani Raja Kumar
 * Date: Feb 16, 2005
 * Time: 7:44:02 PM
 * To change this template use Options | File Templates.
 */
public class PurchaseOrderActionCommandFactory implements Constants
{

    private static PurchaseOrderActionCommandFactory sPacfactory;

    public synchronized static PurchaseOrderActionCommandFactory getInstance()
    {
        if ( sPacfactory == null )
        {
            sPacfactory = new PurchaseOrderActionCommandFactory();
        }
        return sPacfactory;
    }

    private PurchaseOrderActionCommandFactory()
    {
    }

    /**
     * Returns the ActionCommand Class that implements businnes logic for the given action
     *
     * @param action
     * @return
     */
    public static ChipTrackExtendedAction getActionCommand( String action )
    {
        if ( ACTION_GENERATE.equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderGenerateCommand();
        }
        if ( ACTION_NEW.equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderNewCommand();
        }
        if ( ACTION_LOAD_PART_NUMBERS.equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderLoadPartNumbersCommand();
        }
        if ( ACTION_ADD_LINEITEM.equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderAddLineItemCommand();
        }
        if ( ACTION_CONFIRM .equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderConfirmCommand();
        }
        if ( ACTION_EDIT .equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderEditCommand();
        }
        if ( ACTION_SAVE .equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderSaveCommand();
        }
        if ( ACTION_LOAD .equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderLoadCommand();
        }
        if ( ACTION_PURCHASE_ORDER_LINE_ITEM_LOT_DATA_ENTRY.equalsIgnoreCase ( action) )
        {
            return new PurchaseOrderLineItemLotDataEntryCommand();
        }
        if ( ACTION_PURCHASE_ORDER_LOT_DATA_ENTRY_ADD_MORE.equalsIgnoreCase ( action) )
        {
            return new PurchaseOrderLineItemLotDataEntryAddCommand();
        }
        if ( ACTION_PURCHASE_ORDER_LINE_ITEM_LOT_DATA_ENTRY_CLOSE.equalsIgnoreCase ( action) )
        {
            return new PurchaseOrderLineItemLotDataEntryCloseCommand();
        }
        if( ACTION_PURCHASE_ORDER_PRINT_VIEW.equalsIgnoreCase( action ) )
        {
            return new StandardPurchaseOrderPrinterFriendlyCommand();
        }
        if( ACTION_PURCHASE_ORDER_LOAD_PACKAGE_TYPE.equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderLoadPackageTypeCommand();
        }
        
        if( ACTION_PURCHASE_ORDER_LOAD_VENDOR_PART_NUMBERS.equalsIgnoreCase( action ) )
        {
        	return new PurchaseOrderLoadVendorPartNumberCommand();
        }
        if( ACTION_PURCHASE_ORDER_SAVE_PACKAGE_TYPE.equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderSavePackageTypeCommand();
        }
        if ( "savePOReport" .equalsIgnoreCase( action ) )
        {
            return new PurchaseOrderSaveCSVFileCommand();
        }
        return null;
    }

}
